---
title: "SQL-014: Delete a task"
summary: Complete (soft-delete) a task via the pk82036_task.task_delete stored procedure.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Business.Tasks
reference_type: embedded
---

# SQL-014 Delete a task

Completes/deletes a `TASK` row by calling the Oracle stored procedure `pk82036_task.task_delete`, protected by the `UPDATE_SEQ_NUM` optimistic-concurrency token.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-014 |
| **Operation type** | Delete |
| **Execution method** | Stored procedure |
| **Database** | Oracle |
| **Schema** | `[unqualified]`** |
| **Command type** | StoredProcedure |
| **Business object** | `clsTask` |
| **Criteria property** | `DeleteSQL` |
| **Lifecycle method** | `BeforeDelete` / `AfterDelete` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:TaskSeqNum` | Input | Decimal | N/A | Primary key of the task row to delete |
| `:UpdateSeqNum` | Input | Decimal | N/A | Optimistic-concurrency token ([BR-013](../business-rules.md#br-013-optimistic-concurrency-via-update-sequence-number)) |
| `:UpdateUser` | Input | `clsSmartString` | 30 | Set to `IDataPortalInfo.UserID` before the call |
| `:RowsAffected` | ReturnValue | Integer | N/A | Rows deleted; checked by `AfterDelete` ([BR-012](../business-rules.md#br-012-task-delete-must-affect-exactly-one-row)) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [TASK](../database-tables.md#task) | UPDATE (soft-delete)* | `TASK_SEQ_NUM`, `UPDATE_SEQ_NUM`, `UPDATE_USER`, `DELETE_FLAG` |

## Sample SQL

```sql
-- CommandType.StoredProcedure, RequestType = NonQuery, DataRequest.ID = "DELETE"
CALL pk82036_task.task_delete(
  :TaskSeqNum,
  :UpdateSeqNum,
  :UpdateUser,
  :RowsAffected)
```

`TASK.DELETE_FLAG` and the `ShowCompleted` search filter indicate the delete is a logical "completed" soft-delete performed inside the package, but this cannot be confirmed without the procedure body.** The procedure body resides in the Oracle database and was not retrieved in this environment.

## Operations and processes
- [Delete (complete) a task](../operations/delete-complete-task.md)
- [Save a task collection](../operations/save-task-collection.md)

## Business rules
- [BR-012: Task delete must affect exactly one row](../business-rules.md#br-012-task-delete-must-affect-exactly-one-row)
- [BR-013: Optimistic concurrency via UPDATE_SEQ_NUM](../business-rules.md#br-013-optimistic-concurrency-via-update-sequence-number)

## Sources
- SAIF.Business.Tasks/clsTask.vb
